package com.gopay.common.riskcontrol.dao.impl;

import com.gopay.common.base.dao.impl.BaseReadDAOImpl;
import com.gopay.common.domain.riskcontrol.RcQuickpayModelConfig;
import com.gopay.common.riskcontrol.dao.RcQuickpayModelConfigQueryDao;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author gaocl
 * Created by gaocl on 2017/11/17.
 */
@Repository("rcQuickpayConfigQueryDAO")
public class RcQuickpayModelConfigQueryDaoImpl extends BaseReadDAOImpl<RcQuickpayModelConfig,String> implements RcQuickpayModelConfigQueryDao {
@Override
    public List<RcQuickpayModelConfig> findRcQuickpayConfig(String modelType) {
        String hql="from RcQuickpayModelConfig t where t.modelType = :modelType order by t.id asc";
        Map<String,Object> map = new HashMap<>();
        map.put("modelType",modelType);
        return this.findByHql(hql, map);
    }
    @Override
    public List<RcQuickpayModelConfig> getByRuleCodeStat(String modelType,String stat,String ruleCode){
        String hql=" from RcQuickpayModelConfig t where t.modelType=:modelType and t.stat=:stat and t.ruleCode=:ruleCode order by t.dealType asc ";
        Map<String, Object> param = new HashMap<>();
        param.put("modelType", modelType);
        param.put("stat", stat);
        param.put("ruleCode", ruleCode);
        List<RcQuickpayModelConfig> list=this.findByHql(hql, param);
        return list;
    }

}
